package com.erp.common;

import lombok.Data;

//此类作为controller层返回
@Data
public class ResponseMessage<T> {
    int code;
    T data;

    public ResponseMessage(){
    }

    private ResponseMessage(int code){
        this.code = code;
    }

    public ResponseMessage(int code,T data){
        this.code = code;
        this.data = data;
    }

    public ResponseMessage(T data){
        this.code = 200;
        this.data = data;
    }


    public static ResponseMessage ok(){
        return new ResponseMessage(200);
    }

    public static  ResponseMessage fail(String message){
        return new ResponseMessage(400,message);
    }

}
